Showing the CS-TRS Ex14_AEGL02:
Functions: from cons s length nil 0 length1
Constructors: cons s nil 0
Variables: X Y
Arities:
ar(from) = 1
ar(cons) = 2
ar(s) = 1
ar(length) = 1
ar(nil) = 0
ar(0) = 0
ar(length1) = 1
Replacement map:
µ(from)={1}
µ(cons)={1}
µ(s)={1}
µ(length)={}
µ(nil)={}
µ(0)={}
µ(length1)={}
Rules: (file Ex14_AEGL02)
from(X) -> cons(X,from(s(X)))
length(nil) -> 0
length(cons(X,Y)) -> s(length1(Y))
length1(X) -> length(X)
obj Ex14_AEGL02 is sort S . op from : S -> S . op cons : S S -> S [strat (1 0)] . op s : S -> S . op length : S -> S [strat (0)] . op nil : -> S . op 0 : -> S . op length1 : S -> S [strat (0)] . vars X Y : S . eq from(X) = cons(X,from(s(X))) . eq length(nil) = 0 . eq length(cons(X,Y)) = s(length1(Y)) . eq length1(X) = length(X) . endo
from(X) -> cons(X)
length -> 0
length -> s(length1)
length1 -> length
is not terminating.
obj Ex14_AEGL02_1 is sort S . op from : S -> S . op cons : S S -> S [strat (1 0)] . op s : S -> S . vars X : S . eq from(X) = cons(X,from(s(X))) . endoand
obj Ex14_AEGL02_2 is sort S . op length : S -> S [strat (0)] . op cons : S S -> S [strat (1 0)] . op s : S -> S . op length1 : S -> S [strat (0)] . op nil : -> S . op 0 : -> S . vars X Y : S . eq length(cons(X,Y)) = s(length1(Y)) . eq length(nil) = 0 . eq length1(X) = length(X) . endoThe modules Ex14_AEGL02_1 and Ex14_AEGL02_2 can be proved terminating by using the following polynomial interpretations (computed with MuTerm):
Proof of termination for Ex14_AEGL02_1:
[from](X) = X + 1
[cons](X1,X2) = X1
[s](X) = X
and
Proof of termination for Ex14_AEGL02_2: [length](X) = X [cons](X1,X2) = X1 + X2 + 2 [s](X) = X [length1](X) = X + 1 [nil] = 1 [0] = 0
a__from(X) -> cons(mark(X),from(s(X)))
a__length(nil) -> 0
a__length(cons(X,Y)) -> s(a__length1(Y))
a__length1(X) -> a__length(X)
mark(from(X)) -> a__from(mark(X))
mark(length(X)) -> a__length(X)
mark(length1(X)) -> a__length1(X)
mark(cons(X1,X2)) -> cons(mark(X1),X2)
mark(s(X)) -> s(mark(X))
mark(nil) -> nil
mark(0) -> 0
a__from(X) -> from(X)
a__length(X) -> length(X)
a__length1(X) -> length1(X)
which result from the previous modular decomposition are terminating
(use CiME).